<template>
    <div class="form">
        <div class="el-form-item edit-form is-required">
            <label for="question" class="el-form-item__label" style="width: 100px;">答案列表</label>
            <div class="el-form-item__content" style="margin-left: 100px;">
                <el-table :data="answer_list" border style="width: 100%">
                    <el-table-column label="答案">
                        <template slot-scope="scope">
                            <el-input v-model="scope.row.answer" placeholder="请输入内容"></el-input>
                        </template>
                    </el-table-column>
                    <el-table-column label="是否正确" width="200">
                        <template slot-scope="scope">
                        <el-switch
                            v-model="scope.row.is_correct"
                            active-color="#13ce66"
                            inactive-color="#ff4949">
                        </el-switch>
                        </template>
                    </el-table-column>
                    <!-- <el-table-column label="金币数">
                        <template slot-scope="scope">
                            <el-input type="number" v-model="scope.row.gold_coin" placeholder="请输入金币数"></el-input>
                        </template>
                    </el-table-column> -->
                    <el-table-column label="操作" width="200">
                        <template slot-scope="scope">
                            <el-button v-if="scope.$index == 0" @click='add_db(scope.row)' type="info" size="small">+</el-button>
                            <el-button v-if="scope.$index != 0" @click='reduce_db(scope.$index)' type="warning" size="small">-</el-button>
                        </template>
                    </el-table-column>
                </el-table>
            </div>
        </div>
        <form-data
            :FieldList='fields'
            :DefaultValue='default_value'
            :Rules="rules"
            @onSubmit='onSubmit'></form-data>
    </div>
</template>

<script>
import EditJs from "./Edit.js";
export default EditJs;
</script>

<style scoped lang='less'>
@import url(Edit.less);
</style>